package com.avengers.common.bean;

import com.avengers.common.bean.enums.ContactExternalRegistrarStatus;
import com.google.gson.annotations.SerializedName;

/**
 * @author yu.wang
 * @since 1/27/21 11:52 AM
 **/
public class ContactExternalRegistrarInfo {
    private ContactExternalRegistrarInfo() {
    }

    @SerializedName("r")
    private String registrar;
    @SerializedName("s")
    private Integer status;
    @SerializedName("f")
    private String failReason;

    public String getRegistrar() {
        return registrar;
    }

    public void setRegistrar(String registrar) {
        this.registrar = registrar;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public static ContactExternalRegistrarInfo of(String registrar, ContactExternalRegistrarStatus status) {
        ContactExternalRegistrarInfo info = new ContactExternalRegistrarInfo();
        info.setRegistrar(registrar);
        info.setStatus(status.value);
        return info;
    }

    public static ContactExternalRegistrarInfo fail(String registrar, String failReason) {
        ContactExternalRegistrarInfo info = new ContactExternalRegistrarInfo();
        info.setRegistrar(registrar);
        info.setStatus(ContactExternalRegistrarStatus.fail.value);
        info.setFailReason(failReason);
        return info;
    }
}
